"use strict";
cc._RF.push(module, '8c5b6fpATBMXbIq7jHbcOsG', 'h5Api');
// scripts/engines/services/miniGameContent/h5/h5Api.ts

"use strict";
var __extends = (this && this.__extends) || (function () {
    var extendStatics = function (d, b) {
        extendStatics = Object.setPrototypeOf ||
            ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
            function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
        return extendStatics(d, b);
    };
    return function (d, b) {
        extendStatics(d, b);
        function __() { this.constructor = d; }
        d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
    };
})();
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
    function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
    return new (P || (P = Promise))(function (resolve, reject) {
        function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
        function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
        function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
        step((generator = generator.apply(thisArg, _arguments || [])).next());
    });
};
var __generator = (this && this.__generator) || function (thisArg, body) {
    var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
    return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
    function verb(n) { return function (v) { return step([n, v]); }; }
    function step(op) {
        if (f) throw new TypeError("Generator is already executing.");
        while (_) try {
            if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
            if (y = 0, t) op = [op[0] & 2, t.value];
            switch (op[0]) {
                case 0: case 1: t = op; break;
                case 4: _.label++; return { value: op[1], done: false };
                case 5: _.label++; y = op[1]; op = [0]; continue;
                case 7: op = _.ops.pop(); _.trys.pop(); continue;
                default:
                    if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
                    if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
                    if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
                    if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
                    if (t[2]) _.ops.pop();
                    _.trys.pop(); continue;
            }
            op = body.call(thisArg, _);
        } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
        if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
    }
};
Object.defineProperty(exports, "__esModule", { value: true });
var miniApp_1 = require("../miniApp");
var H5Api = /** @class */ (function (_super) {
    __extends(H5Api, _super);
    function H5Api() {
        var _this = _super !== null && _super.apply(this, arguments) || this;
        _this.m_appId = '';
        _this.m_secret = '';
        _this.m_adUnitId = '';
        return _this;
    }
    H5Api.prototype.commitRank = function (rankId, score) {
        return __awaiter(this, void 0, Promise, function () {
            return __generator(this, function (_a) {
                return [2 /*return*/, Promise.resolve(false)];
            });
        });
    };
    H5Api.prototype.showRank = function (rankId) {
        return __awaiter(this, void 0, Promise, function () {
            return __generator(this, function (_a) {
                return [2 /*return*/, Promise.resolve(false)];
            });
        });
    };
    H5Api.prototype.LocalInBlockCityList = function () {
        return false;
    };
    H5Api.prototype.vibrate = function (type) {
        console.log('h5 振动');
    };
    H5Api.getRandNameAndUrl = function () {
        var user = {
            nickName: "\u96F6\u4E00\u4FA0",
            avatarUrl: null,
            language: 'ch',
            gender: 0,
            country: '中国',
            province: '',
            city: '',
        };
        return user;
    };
    ;
    H5Api.prototype.validAppId = function () {
    };
    H5Api.prototype.getUserInfo = function (params) {
        params.success && params.success({ userInfo: H5Api.getRandNameAndUrl() });
    };
    H5Api.prototype.showToast = function (params) {
        // O1HD.getManagers().uiMgr.showMessageBox(params.title);
    };
    H5Api.prototype.showLoading = function (params) {
        console.log('h5 显示进度', params);
    };
    H5Api.prototype.hideLoading = function () {
        console.log('h5 隐藏进度');
    };
    H5Api.prototype.preCreateUnits = function () {
        // console.log(DEEP_NEXT_SPLIT, 'h5 预先创建');
    };
    H5Api.prototype.loadAndShowVideoAd = function (successCallback, errorCallback, completeCallback, title) {
        console.log("H5 \u5E7F\u544A\u52A0\u8F7D\u5E76\u663E\u793A,\u53D1\u9001\u57CB\u70B9" + title);
        successCallback && successCallback();
        completeCallback && completeCallback();
    };
    H5Api.prototype.authorize = function (params) {
        params.success && params.success();
    };
    H5Api.prototype.login = function (params) {
        params.success && params.success({ code: null });
    };
    H5Api.prototype.gameRecordStart = function (params, onStart) {
        console.log('h5 录屏start');
        onStart && onStart(null);
    };
    H5Api.prototype.gameRecordStop = function () {
        console.log('h5 录屏stop');
        return true;
    };
    H5Api.prototype.shareGameRecordVideo = function (successCb, failCb) {
        console.log('h5 分享录屏');
        successCb && successCb();
    };
    H5Api.prototype.isProduction = function () {
        return H5Api.isProduction();
    };
    H5Api.prototype.isHaveShareVideo = function () {
        return true;
    };
    H5Api.prototype.reportAnalytics = function (EventKey, data) {
        console.log('h5 发送埋点');
        return;
    };
    H5Api.prototype.clearMemory = function () {
    };
    H5Api.prototype.shareAppMessage = function (args) {
    };
    H5Api.prototype.operateGameLive = function () {
    };
    H5Api.isProduction = function () {
        return true;
    };
    H5Api.prototype.createMoreGameBtn = function () {
    };
    H5Api.prototype.hideBanner = function () {
    };
    H5Api.prototype.showBannerAD = function (node, successCallback, errorCallback) {
    };
    H5Api.prototype.showInterstitialAd = function (onAdClose, onFailed) {
    };
    H5Api.prototype.showNativeAd = function () {
    };
    H5Api.prototype.reportAdClickNativeAd = function () {
    };
    H5Api.prototype.addShortcut = function () {
        console.log('h5 添加桌面');
        //
        return Promise.resolve(true);
    };
    H5Api.prototype.drawUrlImage = function (url, overCb) {
        cc.assetManager.loadRemote(url, function (err, asset) {
            if (err) {
                console.error('#1553937 图片出错', err);
                overCb(null);
                return;
            }
            overCb(new cc.SpriteFrame(asset));
        });
    };
    H5Api.prototype.showVideo = function (videoUrl) {
    };
    H5Api.prototype.getShareVideoRank = function (sortType, successCb) {
        successCb([
            {
                cover_url: "https://p6.toutiaoimg.com/img/tos-cn-i-0022/21042eee9d1a44cda8835b0586cf1d90~noop.jpeg?from=shortvideo",
                create_time: "2021-04-07 21:15:12",
                digg_count: "0",
                rank: 7,
                source: 13,
                user_name: "Visitor",
                video_id: "131047150d294037025515410e7d436501502b42017e4c605757404d01734560505247440973",
                video_tag: ""
            },
            {
                cover_url: "https://p6.toutiaoimg.com/img/tos-cn-i-0022/21042eee9d1a44cda8835b0586cf1d90~noop.jpeg?from=shortvideo",
                create_time: "2021-04-07 21:15:12",
                digg_count: "0",
                rank: 7,
                source: 13,
                user_name: "Visitor",
                video_id: "131047150d294037025515410e7d436501502b42017e4c605757404d01734560505247440973",
                video_tag: ""
            },
            {
                cover_url: "https://p6.toutiaoimg.com/img/tos-cn-i-0022/21042eee9d1a44cda8835b0586cf1d90~noop.jpeg?from=shortvideo",
                create_time: "2021-04-07 21:15:12",
                digg_count: "0",
                rank: 7,
                source: 13,
                user_name: "Visitor",
                video_id: "131047150d294037025515410e7d436501502b42017e4c605757404d01734560505247440973",
                video_tag: ""
            },
            {
                cover_url: "https://p6.toutiaoimg.com/img/tos-cn-i-0022/21042eee9d1a44cda8835b0586cf1d90~noop.jpeg?from=shortvideo",
                create_time: "2021-04-07 21:15:12",
                digg_count: "0",
                rank: 7,
                source: 13,
                user_name: "Visitor",
                video_id: "131047150d294037025515410e7d436501502b42017e4c605757404d01734560505247440973",
                video_tag: ""
            },
            {
                cover_url: "https://p6.toutiaoimg.com/img/tos-cn-i-0022/21042eee9d1a44cda8835b0586cf1d90~noop.jpeg?from=shortvideo",
                create_time: "2021-04-07 21:15:12",
                digg_count: "0",
                rank: 7,
                source: 13,
                user_name: "Visitor",
                video_id: "131047150d294037025515410e7d436501502b42017e4c605757404d01734560505247440973",
                video_tag: ""
            },
            {
                cover_url: "https://p6.toutiaoimg.com/img/tos-cn-i-0022/21042eee9d1a44cda8835b0586cf1d90~noop.jpeg?from=shortvideo",
                create_time: "2021-04-07 21:15:12",
                digg_count: "0",
                rank: 7,
                source: 13,
                user_name: "Visitor",
                video_id: "131047150d294037025515410e7d436501502b42017e4c605757404d01734560505247440973",
                video_tag: ""
            },
            {
                cover_url: "https://p6.toutiaoimg.com/img/tos-cn-i-0022/21042eee9d1a44cda8835b0586cf1d90~noop.jpeg?from=shortvideo",
                create_time: "2021-04-07 21:15:12",
                digg_count: "0",
                rank: 7,
                source: 13,
                user_name: "Visitor",
                video_id: "131047150d294037025515410e7d436501502b42017e4c605757404d01734560505247440973",
                video_tag: ""
            },
            {
                cover_url: "https://p6.toutiaoimg.com/img/tos-cn-i-0022/21042eee9d1a44cda8835b0586cf1d90~noop.jpeg?from=shortvideo",
                create_time: "2021-04-07 21:15:12",
                digg_count: "0",
                rank: 7,
                source: 13,
                user_name: "Visitor",
                video_id: "131047150d294037025515410e7d436501502b42017e4c605757404d01734560505247440973",
                video_tag: ""
            },
            {
                cover_url: "https://p6.toutiaoimg.com/img/tos-cn-i-0022/21042eee9d1a44cda8835b0586cf1d90~noop.jpeg?from=shortvideo",
                create_time: "2021-04-07 21:15:12",
                digg_count: "0",
                rank: 7,
                source: 13,
                user_name: "Visitor",
                video_id: "131047150d294037025515410e7d436501502b42017e4c605757404d01734560505247440973",
                video_tag: ""
            },
            {
                cover_url: "https://p6.toutiaoimg.com/img/tos-cn-i-0022/21042eee9d1a44cda8835b0586cf1d90~noop.jpeg?from=shortvideo",
                create_time: "2021-04-07 21:15:12",
                digg_count: "0",
                rank: 7,
                source: 13,
                user_name: "Visitor",
                video_id: "131047150d294037025515410e7d436501502b42017e4c605757404d01734560505247440973",
                video_tag: ""
            },
        ]);
    };
    H5Api.prototype.subscribeMessage = function () {
    };
    H5Api.prototype.showAddFavoriteGuide = function (successCallback, failCallback, completeCallback) {
    };
    H5Api.prototype.PlayLastRecordSound = function (scale, successCb, errorCb) {
        setTimeout(function () {
            successCb && successCb();
        }, 1000);
    };
    H5Api.prototype.StartRecordSound = function () {
    };
    H5Api.prototype.StopRecordSound = function (successCallback) {
        setTimeout(function () {
            successCallback && successCallback();
        }, 1000);
    };
    H5Api.prototype.showModal = function (params) {
        console.log('h5 对话框', params);
    };
    H5Api.prototype.navigateToMiniGame = function (appId, successCallback, failCallback) {
        console.log('h5 跳转到其他小游戏', appId);
        successCallback && successCallback();
    };
    H5Api.prototype.WidgetfullScreen = function () {
        console.log("H5适配");
        cc.director.getScene().getChildByName("Canvas").getComponent(cc.Canvas).fitHeight = true;
    };
    return H5Api;
}(miniApp_1.default));
exports.default = H5Api;

cc._RF.pop();